<html>
<head>
    <title>正在发送...</title>
    <?php if ($hasNext) {   ?>
        <meta http-equiv="refresh" content="0;
                          url=<?php echo $targetUrl; ?>" />
    <?php } ?>
</head>
<body>
        <div class="log">

            <?php
             if ($hasNext) {
                echo '正在发送用户:'.$item['nickname'].'  openid:'.$item['openid'];
             }
            ?>

            <?php if (!$hasNext) {     ?>
                发送完成
            <?php }?>

        </div>
</body>

<script type="text/javascript">
    process();

    function process()
    {
        var data = {
            id: $id
        };
        $.ajax({
            url: "{php echo webUrl('messages/fetch2')}",
            data: data,
            type: "post",
            success:function(data){

                if (data.next) {
                    process();
                }
            }
        });

    }

</script>

</html>